#include<stdio.h>
int main()
{
	char arr[50] = { 0 };
	int flag = 1;
	int count = 0;
	int sz = sizeof(arr) / sizeof(arr[0]);
	gets_s(arr);
	for (int i = 0; i < sz; i++)
	{
		if (arr[i] == ' ')
			flag = 1;
		if (flag == 1)
		{
			count++;
			flag = 0;
		}
		if (arr[i] == ' ' && arr[i + 1] == ' ')
			count--;
	}
	printf("%d\n", count);
	return 0;
}